home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / asm / stkasm02 / transprt.s < prev   
Encoding:
Text File  |  1996-03-19  |  6.8 KB  |  150 lines

  1. *      transprt.h        (c) Steve Adam 1995   steve@netinfo.com.au
  2. *      transprt.s        Goof 1996 arcovang@caiw.nl
  3. *
  4. *      Include this file to use functions from the tcp module.
  5. *      ie: tcp/udp, etc....
  6.  
  7.  
  8.     section data
  9. TRANSPORT_DRIVER    dc.b    "TRANSPORT_TCPIP",0
  10. TCP_DRIVER_VERSION    dc.b    "01.07",0
  11.     even
  12.     section text
  13. ** TCP connection states    
  14. TCLOSED        equ     0   ;No connection.  Null, void, absent, .....        */
  15. TLISTEN        equ     1   ; Wait for remote request.                         */
  16. TSYN_SENT    equ     2   ; Connect request sent.  Await matching request    */
  17. TSYN_RECV    equ     3   ; Wait for connection ACK.  (Listener only??)      */
  18. TESTABLISH    equ     4   ; Connection is established.  Handshake completed  */
  19. TFIN_WAIT1    equ     5   ; Await termination request or acknowledgement     */
  20. TFIN_WAIT2    equ     6   ; Await termination request.                       */
  21. TCLOSE_WAIT    equ     7   ; Await termination request from local user        */
  22. TCLOSING    equ     8   ; Await termination acknowledge from remote TCP    */
  23. TLAST_ACK    equ     9   ; Await acknowledgement of terminate request sent  */
  24. TTIME_WAIT    equ     10   ; Delay to ensure remote has received term' ACK    */
  25. * TCP and connection ERROR states. */
  26. E_NORMAL    equ     0    ; No error occured...                      */
  27. E_OBUFFULL    equ     -1    ; Output buffer is full                    */
  28. E_NODATA    equ     -2    ; No data available.                       */
  29. E_EOF        equ     -3    ; EOF from remote..                        */
  30. E_RRESET    equ     -4    ; RST received from remote.                */
  31. E_UA        equ     -5    ; RST.  Other end sent unacceptable pkt    */
  32. E_NOMEM        equ     -6    ; Something failed due to lack of memory   */
  33. E_REFUSE    equ     -7    ; Connection refused by remote             */
  34. E_BADSYN    equ     -8    ; A SYN was received in the window         */
  35. E_BADHANDLE    equ     -9    ; Bad connection handle used.              */
  36. E_LISTEN    equ     -10    ; The connection is in LISTEN state        */
  37. E_NOCCB        equ     -11    ; No free CCB's available                  */
  38. E_NOCONNECTION    equ     -12    ; No connection matches this packet. (TCP) */
  39. E_CONNECTFAIL    equ     -13    ; Failure to connect to remote port. (TCP) */
  40. E_BADCLOSE    equ     -14    ; Invalid TCP_close() requested            */
  41. E_USERTIMEOUT    equ     -15    ; A user function timed out                */
  42. E_CNTIMEOUT    equ     -16    ; A the connection timed out               */
  43. E_CANTRESOLVE    equ     -17    ; Can't resolve the hostname               */
  44. E_BADDNAME    equ     -18    ; Domain name or Dotted Dec.  bad format   */
  45. E_LOSTCARRIER    equ     -19    ; The modem disconnected                   */
  46. E_NOHOSTNAME    equ     -20    ; Hostname does not exist                  */
  47. E_DNSWORKLIMIT    equ     -21    ; Resolver Work limit reached              */
  48. E_NONAMESERVER    equ     -22    ; No nameservers could be found for query  */
  49. E_DNSBADFORMAT    equ     -23    ; Bad format of DS query                   */
  50. E_UNREACHABLE    equ     -24    ; Destination unreachable                  */
  51. E_DNSNOADDR    equ     -25    ; No address records exist for host        */
  52. E_LASTERROR    equ     25    ; ABS of last error code in this list      */
  53.  
  54. * FLagbox Flag definitions    (max 64 flags...) */
  55. FL_do_resolve    equ     0
  56. FL_housekeep    equ     1
  57.  
  58.  
  59. ; Input queue structures   */
  60.  
  61. ;typedef struct ndb {    ;  Network Data Block.  For data delivery      */
  62. ;    char        *ptr;   ; Pointer to base of block. (For KRfree();)    */
  63. ;    char        *ndata; ; Pointer to next data to deliver              */
  64. ;    uint16      len;    ; Length of remaining data.                    */
  65. ;    struct ndb  *next;  ; Next NDB in chain or NULL                    */
  66. ;} NDB;
  67.  
  68.  
  69. ; Connection information block    */
  70.  
  71. ;typedef struct cib {        ; Connection Information Block.    */
  72. ;    uint16      protocol;   ; TCP or UDP or ... 0 means CIB not in use */
  73. ;    uint16      lport;      ; TCP client port.  (ie: At this machine)  */
  74. ;    uint16      rport;      ; TCP server port.  (ie: remote machine)   */
  75. ;    uint32      rhost;      ; TCP server IP addr. (ie: remote machine) */
  76. ;} CIB;
  77. ;
  78. ;  Values for protocol field    */
  79. P_ICMP    equ     1
  80. P_TCP    equ     6
  81. P_UDP    equ     17
  82.  
  83.  
  84. ;  Transport structure/functions   */
  85.  
  86. ;typedef struct tpl {
  87. ;    char    *module;    ; specific string that can be searched for */
  88. ;    char    *author;    ; Any string                               */
  89. ;    char    *version;   ; Format `00.00' Version:Revision          */
  90. ;    char  * cdecl (*KRmalloc)(int32);
  91. ;    void    cdecl (*KRfree)(char *);
  92. ;    int32   cdecl (*KRgetfree)(int16 x);
  93. ;    char  * cdecl (*KRrealloc)(char *, int32);
  94. ;    char  * cdecl (*get_err_text)(int16);
  95. ;    char  * cdecl (*getvstr)(char *);
  96. ;    int16   cdecl (*carrier_detect)(void);
  97. ;    int16   cdecl (*TCP_open)(uint32, int16, int16, uint16);
  98. ;    int16   cdecl (*TCP_close)(int16, int16);
  99. ;    int16   cdecl (*TCP_send)(int16, char *, int16);
  100. ;    int16   cdecl (*TCP_wait_state)(int16, int16, int16);
  101. ;    int16   cdecl (*TCP_ack_wait)(int16, int16);
  102. ;    int16   cdecl (*UDP_open)(uint32, int16);
  103. ;    int16   cdecl (*UDP_close)(int16);
  104. ;    int16   cdecl (*UDP_send)(int16, char *, int16);
  105. ;    int16   cdecl (*CNkick)(int16);
  106. ;    int16   cdecl (*CNbyte_count)(int16);
  107. ;    int16   cdecl (*CNget_char)(int16);
  108. ;    NDB   * cdecl (*CNget_NDB)(int16);
  109. ;    int16   cdecl (*CNget_block)(int16, char *, int16);
  110. ;    void    cdecl (*housekeep)(void);
  111. ;    int16   cdecl (*resolve)(char *, char ;, uint32 *, int16);
  112. ;    void    cdecl (*ser_disable)(void);
  113. ;    void    cdecl (*ser_enable)(void);
  114. ;    int16    cdecl (*set_flag)(int16);
  115. ;    void    cdecl (*clear_flag)(int16);
  116. ;    CIB   * cdecl (*CNgetinfo)(int16);
  117. ;} TPL;
  118. ;
  119. ;extern TPL *tpl;
  120.  
  121. ;KRmalloc(x)             (*tpl->KRmalloc)(x)
  122. ;KRfree(x)               (*tpl->KRfree)(x)        
  123. ;KRgetfree(x)            (*tpl->KRgetfree)(x)
  124. ;KRrealloc(x,y)          (*tpl->KRrealloc)(x,y)
  125. ;get_err_text(x)         (*tpl->get_err_text)(x)
  126. ;getvstr(x)              (*tpl->getvstr)(x)
  127. ;carrier_detect()        (*tpl->carrier_detect)()
  128. ;TCP_open(h,p,t,o)       (*tpl->TCP_open)(h,p,t,o)
  129. ;TCP_close(x,y)          (*tpl->TCP_close)(x,y)
  130. ;TCP_send(x,y,z)         (*tpl->TCP_send)(x,y,z)
  131. ;TCP_wait_state(x,y,z)   (*tpl->TCP_wait_state)(x,y,z)
  132. ;TCP_ack_wait(x,y)       (*tpl->TCP_ack_wait)(x,y)
  133. ;UDP_open(x,y)           (*tpl->UDP_open)(x,y)
  134. ;UDP_close(x)            (*tpl->UDP_close)(x)
  135. ;UDP_send(x,y,z)         (*tpl->UDP_send)(x,y,z)
  136. ;CNkick(x)               (*tpl->CNkick)(x)
  137. ;CNbyte_count(x)         (*tpl->CNbyte_count)(x)
  138. ;CNget_char(x)           (*tpl->CNget_char)(x)
  139. ;CNget_NDB(x)            (*tpl->CNget_NDB)(x)
  140. ;CNget_block(x,y,z)      (*tpl->CNget_block)(x,y,z)
  141. ;housekeep()             (*tpl->housekeep)()
  142. ;resolve(w,x,y,z)        (*tpl->resolve)(w,x,y,z)
  143. ;ser_disable()           (*tpl->ser_disable)()
  144. ;ser_enable()            (*tpl->ser_enable)()
  145. ;set_flag(x)             (*tpl->set_flag)(x)
  146. ;clear_flag(x)           (*tpl->clear_flag)(x)
  147. ;CNgetinfo(x)            (*tpl->CNgetinfo)(x)
  148. ;
  149. ;#endif ; STIK_TRANSPRT_H */
  150.